package game.editor;

import game.MainController;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

/**
 * @author Fredrik
 *
 */
public class ToolPanel extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5252139728191270225L;
	
	private JButton buttonNew = new JButton("New Word");
	private JButton buttonConnect = new JButton("Connect");
	private JButton buttonEdit = new JButton("Edit");
	private JButton buttonDelete = new JButton("Delete Word");
	
	private JCheckBox editingModeCheckBox = new JCheckBox("Editing Mode");
	private MainController controller;
	
	/**
	 * Constructor creating a new tool panel
	 * @param mainController
	 */
	public ToolPanel(MainController mainController) {
		this.controller = mainController;
		
		
		this.buttonNew.setActionCommand(MainController.BUTTON_ACTION_NEW_WORD);
		this.buttonNew.addActionListener(this.controller);
		
		this.buttonConnect.setActionCommand(MainController.BUTTON_ACTION_CONNECT_WORDS);
		this.buttonConnect.addActionListener(this.controller);

		this.buttonEdit.setActionCommand(MainController.BUTTON_ACTION_EDIT_WORD);
		this.buttonEdit.addActionListener(this.controller);
		
		this.buttonDelete.setActionCommand(MainController.BUTTON_ACTION_DELETE);
		this.buttonDelete.addActionListener(this.controller);
		
		
		
		this.setBorder(new LineBorder(new Color(0,0,0)));
		this.setLayout(new GridLayout(1,5));
		this.add(this.buttonNew);
		this.add(this.buttonConnect);
		this.add(this.buttonEdit);
		this.add(this.buttonDelete);
		this.add(this.editingModeCheckBox);
		
		this.editingModeCheckBox.setSelected(true);
		this.editingModeCheckBox.setActionCommand(MainController.EDITING_ACTION);
		this.editingModeCheckBox.addActionListener(this.controller);
	}
	

}
